//实现文章评论功能
const { Comment } = require('../../model/comment');
module.exports = async(req, res) => {
    //接收客户端传递来的post请求参数
    const { content, uid, aid } = req.body;
    //将评论信息存入数据库集合中
    await Comment.create({
        content: content,
        uid: uid,
        aid: aid,
        time: new Date()
    });
    //将页面重定向回文章详情页面
    res.redirect('/home/article?id=' + aid);
}